import { FormFieldModel, FormModel, FormTypeEnum } from 'pf-component';

export const loginForm = (): FormModel => {
  return new FormModel({
    name: 'loginForm',
    fields: [
      new FormFieldModel({
        prop: 'username',
        // label: "用户名",
        labelWidth: '0px',
        placeholder: '请输入用户名',
        required: true,
        showMessage: true,
        inlineMessage: false,
        showPassword: false,
        rules: [],
        prefix: 'el-icon-user'
      }),
      new FormFieldModel({
        prop: 'password',
        // label: "密码",
        labelWidth: '0px',
        placeholder: '请输入密码',
        required: true,
        showMessage: true,
        inlineMessage: false,
        showPassword: true,
        rules: [],
        prefix: 'el-icon-lock'
      }),
      new FormFieldModel({
        prop: 'loginType',
        // label: "密码",
        labelWidth: '0px',
        placeholder: '请选择登录方式',
        type: FormTypeEnum.SELECT.code,
        required: true,
        showMessage: true,
        inlineMessage: false,
        showPassword: false,
        rules: [],
        value: '1',
        options: [
          { key: '1', value: '用户名' },
          { key: '0', value: '手机号' }
        ]
      }),
      new FormFieldModel({
        prop: 'verifyCode',
        // label: "密码",
        labelWidth: '0px',
        placeholder: '请输入验证码',
        required: true,
        showMessage: true,
        inlineMessage: false,
        showPassword: false,
        rules: [],
        append: 'verifyCode'
      }),
      new FormFieldModel({
        prop: 'rememberMe',
        // label: "爱好",
        labelWidth: '0px',
        type: FormTypeEnum.CHECKBOX.code,
        required: false,
        showMessage: true,
        inlineMessage: false,
        showPassword: false,
        options: [{ key: '1', value: '记住当前用户' }],
        value: [], // checkbox时，只能时数组
        rules: []
      })
    ],
    rules: []
  });
};
